package com.qzw.demo.service.entity;

import com.qzw.common.service.BaseEntity;
import com.qzw.common.util.GeneratorNote;
import com.qzw.security.service.entity.SysUser;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;

/**
 * @author: 屈子威
 * @create: 2020-07-14
 * @description: 用户
 * 这里对于业务User类有两种实现方式，
 * 第一种是利用OneToOne关联SysUser实体类
 * 第二种是直接继承SysUser实体类。JPA的继承策略可以百度了解一下
 **/
@Entity
@DynamicInsert
@DynamicUpdate
@Data
public class DmUser extends BaseEntity<Integer> {
    @GeneratorNote("年龄")
    private Integer age;

    @GeneratorNote("性别")
    private Byte sex;

    @GeneratorNote("sys_user_id")
    @Column(insertable = false,updatable = false)
    private Integer sysUserId;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "sysUserId")
    private SysUser sysUser;


}
